﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//系统内置Func 必需带返回值的泛型委托
// Func可以不带参数，但是必须带一个返回值
public class SystemFunc : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        Func<string> func1 = Show1;
        string a = func1();
        Debug.Log("a:" + a);

        //Func<string, int> func2 = Show2;
        Func<int, string> func2 = Show2;
        func2(1000);
        Debug.Log("func2(1000):" + func2(1000));
    }
    string Show1()
    {
        return "Show1";
    }
    //int Show2(string a)
    //{
    //    return int.Parse(a);
    //}
    string Show2(int a)
    {
        return a.ToString();
    }
    // Update is called once per frame
    void Update()
    {
        
    }
}
